<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta
			name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no"
		/>
		<meta name="format-detection" content="telephone=no" />
		<meta name="format-detection" content="email=no" />
		<meta http-equiv="Pragma" content="no-cache" />
		<meta http-equiv="Cache-Control" content="no-cache" />
		<meta http-equiv="Expires" content="0" />
		<title>患者详情</title>
		<link rel="stylesheet" type="text/css" href="../common/css/common.css" />
		<link rel="stylesheet" type="text/css" href="css/index.css" />
		<link rel="stylesheet" href="../common/css/syalert.min.css" />
		<link rel="stylesheet" type="text/css" href="../common/css/js_msg.css" />
	</head>
	<body class="fontsize-sm">
		<div id="app" v-cloak>
			<!--基础信息-->
			<div class="basic_info">
				<div class="basic_info_sign">
					<p></p>
				</div>
				<div class="basic_info_top flex">
					<div class="basic_info_avater">
						<img src="img/user_default.png" />
					</div>
					<p class="basic_info_name fontsize-btn"></p>
					<p class="basic_info_state text-center" style="display: none">在管</p>
				</div>
				<div class="basic_info_bottom fontsize">
					<p class="basic_info_sex">性别：</p>
					<p class="basic_info_age">年龄：</p>
					<p class="basic_info_type">糖尿病类型：</p>
					<p class="basic_info_confirmdate">确诊日期：</p>
					<p class="basic_info_symtons">简要病史：</p>
				</div>
			</div>
			<!--目录列表-->
			<div class="tab_list clear">
				<ul></ul>
			</div>

			<!--检测目标-->
			<div class="index_target">
				<p class="index_target_title fontsize-btn">控制目标</p>
				<ul class="index_target_table_title fontsize-ml">
					<li>检测项目</li>
					<li>上周</li>
					<li>本周</li>
					<li>本周目标</li>
				</ul>
				<ul class="index_target_table_info fontsize-ml"></ul>
				<div class="none_notice" style="display: none">
					<img src="img/logo_grey.png" />
					<p></p>
				</div>
			</div>
			<div
				class="sy-alert sy-alert-tips animated"
				sy-enter="zoomIn"
				sy-leave="zoomOut"
				sy-type="tips"
				sy-mask="false"
				id="alert3"
			>
				<div class="sy-content">功能完善中，敬请期待</div>
			</div>
			<chat-index ref="chatroom" @click="toChat"></chat-index>
		</div>
	</body>
</html>
<script src="../common/js/jquery-3.6.0.min.js"></script>
<script src="../base.js"></script>
<script src="../common/js/url.min.js"></script>
<script src="../common/js/dream-msg.min.js"></script>
<script src="../common/js/syalert.min.js"></script>
<script src="js/iconfont.js"></script>
<script src="js/util.js"></script>
<script src="js/index.js"></script>
<script src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js "></script>
<script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.0/vconsole.min.js"></script>
<script>
	//	var vConsole = new VConsole();
	var param = { pageUrl: window.location.href }
	$.ajax({
		type: 'post',
		url:
			window.location.host.search('dps') != -1
				? '/dps-jeecg-boot'
				: '/jeecg-boot' + '/sys/wechat/signature',
		dataType: 'json',
		contentType: 'application/json',
		data: JSON.stringify(param),
		success: function (data) {
			console.log('ajax', data, window.location.href)
			var result = data.result
			wx.config({
				debug: false, // 调试时可开启
				appId: result.appId, // <!-- replace -->
				timestamp: result.timestamp, // 必填，填任意数字即可
				nonceStr: result.nonceStr, // 必填，填任意非空字符串即可
				signature: result.signature, // 必填，填任意非空字符串即可
				jsApiList: ['updateAppMessageShareData'], // 必填，随意一个接口即可
				openTagList: ['wx-open-launch-weapp'], // 填入打开小程序的开放标签名
			})
			wx.ready(function () {
				// config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中
				wx.updateAppMessageShareData({
					title: '患者详情', // 分享标题
					desc: '患者详情', // 分享描述
					link: window.location.href, // 分享链接，该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
					imgUrl: 'http://h5.dtx-tech.com/doctor/img/logo.png', // 分享图标
					success: function () {
						// 设置成功
					},
				})
			})
			wx.error(function (res) {
				console.log('wx.error', res)
				// config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名
			})
		},
	})
</script>
<script src="../common/js/vue.global.prod.js?time=202208241102"></script>
<script src="../common/js/vant.min.js"></script>
<script src="../common/js/axios.min.js"></script>
<script type="module">
	import {
		getAction,
		postAction,
		getUrl,
	} from '../common/js/api/vue3-axios-utils.js'
	import { chatIndex } from './js/chatIndex.js'

	const PatientData = {
		data() {
			return {
				chatroomId: '',
				patientId: '',
				isdoctor: false,
				doctorId: '',
				chatDid: '',
			}
		},
		created() {
			this.patientId = url('?userid') || ''
			this.isdoctor = JSON.parse(sessionStorage.getItem('isdoctor'))
			this.doctorId = JSON.parse(localStorage.getItem('did')) || ''
			this.chatDid = JSON.parse(sessionStorage.getItem('chatDid')) || ''
			this.getDoctorPaient()
		},
		methods: {
			getDoctorPaient() {
				getAction(spliceUrl('/100/12/1001209'), {
					patientId: this.patientId,
					doctorId: this.chatDid,
				}).then(res => {
					res = res.data
					console.log(res)
					if (res.success) {
						this.chatroomId = res.result
					}
				})
			},
			toChat() {
				this.$refs.chatroom.isdoctor = this.isdoctor
				if (this.isdoctor) {
					this.$refs.chatroom.linkToIndex(this.chatroomId, this.doctorId)
				} else {
					this.$refs.chatroom.linkToIndex(this.chatroomId, this.patientId)
				}
			},
		},
		components: {
			chatIndex: chatIndex,
		},
	}

	const app = Vue.createApp(PatientData)

	app.use(vant)
	app.use(vant.Lazyload)

	app.mount('#app')
</script>
